package org.nutz.mvc.view;

import com.alibaba.fastjson.serializer.SerializerFeature;
import org.nutz.ioc.Ioc;
import org.nutz.mvc.View;
import org.nutz.mvc.ViewMaker;

/**
 * FastJson视图
 * @author: 薄成文 13-9-12 下午11:29
 * To change this template use File | Settings | File Templates.
 */
public class FastJsonViewMaker implements ViewMaker {

    //fastjson特性参数
    private SerializerFeature[] serializerFeature = {
            SerializerFeature.QuoteFieldNames,
//            SerializerFeature.WriteMapNullValue,
//            SerializerFeature.BrowserCompatible,// 将中文转成unicode
            SerializerFeature.DisableCircularReferenceDetect
    };

    public FastJsonViewMaker() {
    }

    @Override
    public View make(Ioc ioc, String type, String value) {
        if ("fastjson".equalsIgnoreCase(type)) {
            return new FastJsonView(serializerFeature);
        }
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }
}
